******* REPLICATION PACKAGE FOR "FIRM-TO-FIRM RELATIONSHIPS AND THE PASS-THROUGH OF SHOCKS: THEORY AND EVIDENCE" ********
********************************************* Author: Sebastian Heise ***************************************************
*************************************************************************************************************************


*********************
0. Summary
*********************
This replication package contains four main folders: public, census, bloomberg, and matlab. All codes to construct data files using publicly available data are located in the public folder. The bloomberg folder contains the codes needed to generate Figure A.1 and Figure A.2 in the appendix. The codes used to run model simulations and the quantitative analysis are in the matlab folder. The census folder contains the codes to prepare the Census microdata and to perform the empirical analysis at Census. Two Census datasets are used: 1) Longitudinal Firm Trade Transactions Database (LFTTD) and 2) Longitudinal Business Database (LBD). 

In Section 1, I discuss the sources of the data. Section 2 contains the computational requirements. Section 3 describes all files and programs needed to replicate the results. Section 4 contains references.


**********************************************
1. Data Availability and Provenance Statements
**********************************************

The paper uses several datasets:


i. Census-provided data
*************************
The results in the paper use confidential microdata from the U.S. Census Bureau. To gain access to the Census microdata, follow the directions on how to write a proposal for access to the data via a Federal Statistical Research Data Center: https://www.census.gov/about/adrm/ced/apply-for-access.html. The following datasets must be requested in the proposal:

Longitudinal Firm Trade Transactions Database (LFTTD), 1992-2017
Longitudinal Business Database (LBD), 1992-2017


ii. Concordance between hts10 revisions over time
**************************
I use the concordance by Pierce and Schott (2012) and download the data from Peter Schott's website available here: https://sompks4.github.io/sub_data.html in Section 3, labeled "US HS over time concordances" (we use version v2019.7.12). The data is included as Stata file "hts_concordances_20190712_198906_201901.dta" in /public/rawdata. 


iii. GDP deflator
**************************
The U.S. GDP deflator, seasonally adjusted, with 2012=100, is obtained from FRED, available here: https://fred.stlouisfed.org/series/GDPDEF, for the period 1992-2017. The data is included as Excel file "GDPDEF.xls" in /public/rawdata.


iv. Exchange rate data
**************************
The exchange rate data is downloaded from Bloomberg, in U.S. dollar per foreign currency. The data is included as Excel file "ExchangeRatesQ_v2_new.xlsx" in /public/rawdata. I obtain monthly average exchange rates and average across months to the quarter. Numbers highlighted in red are implied exchange rates for Eurozone countries after the introduction of the euro, computed as a currency's official exchange rate to euros obtained from the World Bank (https://datahelpdesk.worldbank.org/knowledgebase/articles/114964-what-are-the-conversion-rates-from-european-moneta) times the exchange rate from euro to dollar from Bloomberg. 


iv. Annual GDP and GDP per capita data for individual countries
**************************
I obtain GDP and GDP per capita (in constant 2010 dollars) of individual countries (except Taiwan) from the World Bank World Development Indicators (World Bank, 2018). These data can be downloaded from the World Bank's database available here: https://databank.worldbank.org/reports.aspx?source=2&series=NY.GDP.MKTP.KD&country=. The GDP series is NY.GDP.MKTP.KD and the GDP per capita series is NY.GDP.PCAP.KD. I include the spreadsheet with the downloaded data as WorldbankGDP.csv in /public/rawdata. 


v. Annual GDP and GDP per capita data for Taiwan
****************************
I obtain GDP and GDP per capita (in USD) for Taiwan from the National Statistics Office of Taiwan. I download the Principal Figures spreadsheet, available here: https://ws.dgbas.gov.tw/001/Upload/464/relfile/10320/2409/table_eng(050).xlsx, using the version from 2018/10/31. I include the data as taiwan_gdp.xlx in /public/rawdata.  


vi. Country ISO codes
****************************
I obtain a mapping of 2-digit to 3-digit ISO codes from Nationsonline.org, available here: https://www.nationsonline.org/oneworld/country_code_list.htm. I include the spreadsheet with the downloaded data as iso_map.xlx in /public/rawdata.  


vii. Census country codes
****************************
I obtain country codes from the U.S. Census Bureau, available here: https://www.census.gov/foreign-trade/schedules/c/country.txt. I include a file with the downloaded data as country_codes.txt in /public/rawdata.


viii. Rule of law data
****************************
The data on countries' rule of law is obtained from the Worldwide Governance Indicators of the World Bank. The dataset can be downloaded here: https://www.worldbank.org/content/dam/sites/govindicators/doc/wgidataset.xlsx. I include a file with the downloaded data as wgidataset.xlsx in /public/rawdata.


ix. Quarterly U.S. real GDP
****************************
I obtain quarterly U.S. real GDP from FRED for the period 1991:q1 - 2021:q4. The data can be downloaded here: https://fred.stlouisfed.org/series/GDPC1. I include a file with the downloaded data as GDPC1.xls in /public/rawdata.


x. Gross output by industry
****************************
I obtain annual gross output by industry and price indices by industry for the period 1997-2016 from the GDP by industry accounts of the BEA. The dataset can be downloaded here: https://www.bea.gov/sites/default/files/2018-04/GDPbyInd_GO_NAICS_1997-2016.xlsx. I include a file with the downloaded data as GDPbyInd_GO_NAICS_1997-2016.xlsx in /public/rawdata.


xi. Detailed input-output Use table for 2002
****************************
I obtain the detailed Use Table from the input-output data of the BEA for 2002. This table is available here: https://apps.bea.gov/industry/zip/2002detail_redef.zip, where the file in this Zip folder used in the project is called IOUseDetail.txt. 


xii. Concordance from BEA codes to consolidated BEA codes
****************************
I construct a concordance from the BEA codes in the IO table to slightly more aggregated BEA codes which can be mapped to NAICS codes. The mapping is constructed by taking the original BEA codes in the IO table and by replacing the last characters of these codes with zeros to generate a final BEA code that appears in the list of codes in the tab "NAICS codes" in the GDPbyInd_GO_NAICS_1997-2016.xlsx file. I include my concordance as bea_bea_cons_conc.xlsx in the /public/rawdata folder.


xiii. Concordance from BEA codes to NAICS codes
****************************
I obtain a concordance from BEA codes to NAICS codes from the tab "NAICS codes" in the GDPbyInd_GO_NAICS_1997-2016.xlsx file, and save the concordance as bea_naics_conc.xlsx in the /public/rawdata folder.


xiv. Pass-through estimates from Berger and Vavra (2019)
****************************
I obtained the data underlying the "Data" series in Fig. 6, panel "Pass-Through", of Berger and Vavra (2019), p. 2140, from Joe Vavra. I include a file with the data as pt_data_Vavra.xlsx in /public/rawdata. 
  

xv. Supplier-customer relationships from the SPLC function in Bloomberg
****************************
Bloomberg reports supplier-customer relationships with the "SPLC" function. I hand-collect the list of firms' suppliers on March 1 in each year in 2012-2018 for each of the top-200 firms by market capitalization in the S&P500 on March 1, 2018. For each of these firms, I run the SPLC function in each year and save the resulting relationships to Excel in the /bloomberg/data/raw_excel folder. Researchers need to obtain a Bloomberg license and download the data into this folder.


xvi. List of the 500 companies in the S&P500 on March 1, 2018
****************************
I obtain the list of the 500 companies in the S&P500 on March 1, 2018 from Bloomberg. I include a file with the data as SPX_as_of_01March2018.xlsx in /bloomberg/data/ticker_name_xwalk. 





*******************************
2. Computational requirements
*******************************

i. Software requirements
*************************

For the Stata and SAS programs in the public and bloomberg folders, the following is needed:

a) Stata MP (code was last run with version 17)

b) SAS (code was last run with version 9.4)



For the simulations in the matlab folder, the following is needed:

a) Matlab (code was last run with version R2023b). Users will need the parallel toolbox.



For the programs in the census folder to be run at the Census, no additional programs need to be installed beyond what is made available by the Census Bureau by default. The following programs are used:

a) Stata MP (code was last run with version 18)

b) SAS (code was last run with version 9.4)



ii. Memory and runtime requirements
***********************************

The code in the public and bloomberg folders was run on a 2-core Intel-based laptop with Microsoft Windows 11 Pro version 10.0.22631 with 16 GB of RAM. The code can be run in 15 minutes in its entirely.

The simulations in the Matlab folder were run on an HPC Cluster consisting of 1 head node and 42 compute nodes. Each compute node has 24 Intel Xeon cores with 188 GB of RAM, and access to 207TB of high-speed network storage.  See file descriptions for individual memory requirements. The MCMC simulation took about one week to complete. The two identification plots each took about one day to run. 

For the code files in census/dofiles, these files are run on the cluster provided by the Census Bureau. The Stata files require 350GB of RAM and take about 5 days to complete. The SAS files to construct the data take 4 days to complete.



****************************
3. Description of files and programs
****************************

*******************
i. Public folder
*******************

The public folder comprises 3 main folders:
	rawdata
	codes
	data

In this folder, I prepare several raw datasets in the /rawdata folder using the codes in the /codes folder. The cleaned datasets are saved in the /data folder. These have to be uploaded into the /data directory at the Census (described in Section iii below).


**************************************************
********** RAWDATA **********
**************************************************

This folder contains several files.


a. HTS10 concordance over time (hts_concordances_20190712_198906_201901.dta)
*******************************************

This file is the concordance of HTS10 codes over time created by Pierce and Schott (2012) and obtained from Peter Schott's website available here: https://sompks4.github.io/sub_data.html in Section 3, labeled "US HS over time concordances" (I use version v2019.7.12). 


b. GDP deflator (GDPDEF.xls)
*******************************************

This file is the GDP deflator from FRED, seasonally adjusted, with 2012=100, obtained from https://fred.stlouisfed.org/series/GDPDEF.


c. Exchange rate data (ExchangeRatesQ_v2_new.xlsx)
*******************************************

This file contains quarterly average exchange rates from Bloomberg, in U.S. dollar per foreign currency. Numbers highlighted in red are implied exchange rates for Eurozone countries after the introduction of the euro, computed as a currency's official exchange rate to euros obtained from the World Bank (https://datahelpdesk.worldbank.org/knowledgebase/articles/114964-what-are-the-conversion-rates-from-european-moneta) times the exchange rate from euro to dollar from Bloomberg. 


d. Annual GDP and GDP per capita data for countries (WorldbankGDP.csv)
*******************************************

This file contains countries' GDP and GDP per capita (in constant 2010 US$) from the World Bank World Development Indicators (World Bank, 2018). These data can be downloaded from the World Bank's database available here: https://databank.worldbank.org/reports.aspx?source=2&series=NY.GDP.MKTP.KD&country=.


e. Annual GDP and GDP per capita data for Taiwan (taiwan_gdp.xlsx)
*******************************************

This file contains Taiwan's GDP and GDP per capita (in US$) from the National Statistics Office of Taiwan. The data can be downloaded from here: https://ws.dgbas.gov.tw/001/Upload/464/relfile/10320/2409/table_eng(050).xlsx. I use the version from 2018/10/31.


f. Country ISO2 and ISO3 codes (iso_map.xlsx)
*******************************************

This file contains a mapping of country ISO3 codes to ISO2 codes from Nationsonline.org. The data can be downloaded here: https://www.nationsonline.org/oneworld/country_code_list.htm.


g. Census country codes (country_codes.txt)
*******************************************

This file contains country codes from the U.S. Census Bureau. The data can be downloaded here: https://www.census.gov/foreign-trade/schedules/c/country.txt.


h. Rule of law data (wgidataset.xlsx)
*******************************************

This file contains information on countries' rule of law obtained from the World Bank's Worldwide Governance Indicators. The data can be downloaded here: https://www.worldbank.org/content/dam/sites/govindicators/doc/wgidataset.xlsx. 


i. Quarterly U.S. real GDP data (GDPC1.xls)
*******************************************

This file contains quarterly U.S. real GDP from 1991:q1 - 2021:q4, seasonally adjusted, in billions of chained 2017 dollars, downloaded from https://fred.stlouisfed.org/series/GDPC1. 


j. Gross output and price indices by industry (GDPbyInd_GO_NAICS_1997-2016.xlsx)
*******************************************

This file contains annual gross output by industry and price indices by industry for the period 1997-2016 from the GDP by industry accounts of the BEA. The dataset can be downloaded here: https://www.bea.gov/sites/default/files/2018-04/GDPbyInd_GO_NAICS_1997-2016.xlsx.


k. Detailed Use Table from the input-output accounts of the BEA in 2002 (IOUse_Detail.txt)
*******************************************

This file contains the detailed Use table from the input-output matrix of the BEA in 2002. This table can be downloaded here: https://apps.bea.gov/industry/zip/2002detail_redef.zip


l. Concordance from BEA codes to aggregated BEA codes (bea_bea_cons_conc.xlsx)
*******************************************

This file contains a concordance from the BEA codes in the input-output table to slightly more aggregated BEA codes that can be mapped to NAICS. The mapping is constructed by taking the original BEA codes in the IO table and by replacing the last characters of these codes with zeros to generate a final BEA code that appears in the list of codes in the tab "NAICS codes" in the GDPbyInd_GO_NAICS_1997-2016.xlsx file.


m. Concordance from BEA codes to NAICS codes (bea_naics_conc.xlsx)
*******************************************

This file contains a concordance from BEA codes to NAICS codes obtained from the tab "NAICS codes" in the GDPbyInd_GO_NAICS_1997-2016.xlsx file.


n. Pass-through estimates from Berger and Vavra (2019) (pt_data_Vavra.xlsx)
*******************************************

This file contains the data underlying the "Data" series in Fig. 6, panel "Pass-Through", of Berger and Vavra (2019), p. 2140. This file has to be uploaded to the /census/data folder at the Census.



**************************************************
********** CODES **********
**************************************************

This folder contains several code files.


a. sas_hts_conc_prep_01.sas
*******************************************

This file imports the HTS10 concordance over time (hts_concordances_20190712_198906_201901.dta) into SAS and generates string versions of the obsolete and new HTS10 codes. The code then saves the file hts_conc_2019.sas7bdat into the /data folder. This output file has to be uploaded to the Census.


b. prep_gdp_deflator.do
*******************************************

This file imports the GDP deflator (GDPDEF.xls) into Stata, generates a continuous quarter number (=year*4 + quarter), and saves the file as Stata file deflator_dec2020.dta into the /data folder. This output file has to be uploaded to the Census. 


c. sas_deflator_prep_01.do
*******************************************

This file transforms the GDP deflator file deflator_dec2020.dta in the /data folder into a SAS file deflator_dec2020.sas7bdat and saves the file into the /data folder. This output file has to be uploaded to the Census. 


d. exchange_rates_quarterly.do
*******************************************

This file loads the raw exchange rate data ExchangeRatesQ_v2_new.xlsx in the /rawdata folder, formats it, converts it to US dollar per foreign currency unit, and computes log exchange rates and exchange rate changes for each country. The file also computes the standard deviation of exchange rate changes in 1992-2017, which is a calibrated parameter in Table 4a. The code generates as output ExchangeRatesQ_v5_new.dta and saves it to /data. This output file has to be uploaded to the Census.  


e. country_vars.do
*******************************************

This file loads the country GDP and GDP per capita data from /rawdata/WorldbankGDP.csv and /rawdata/taiwan_gdp.xlsx, rule of law indices from /rawdata/wgidataset.xlsx, and OECD membership and combines these into one dataset. The dataset is saved as /data/country_indicators3.dta. The code also generates a dataset of assignments of each country to terciles of the GDP per capita and rule of law distribution and saves this file as /data/country_indicators_pct.dta. Both datasets have to be uploaded to the Census.


f. prep_gdp.do
*******************************************

This file prepares the quarterly U.S. GDP data from the GDPC1.xls file in the /rawdata folder. It transforms GDP into log GDP and saves the output as gdpdata_new.csv in the /data folder. This output file has to be uploaded to the Census. 


g. gen_instrument.do
*******************************************

This file prepares each industry's downstream gross output using industries' gross output and the detailed Use table from the input-output accounts of the BEA. The final output is saved as gdp_downstream_cy.dta (6-digit NAICS level) and gdp_downstream_cy_n5.dta (5-digit NAICS level) in the /data folder. These output files have to be uploaded to the Census. 



**************************************************
********** DATA **********
**************************************************

The data folder contains the datasets generated by the codes in the /codes folder from the raw data in the /rawdata folder. The data files in this folder have to be uploaded to the /data folder at Census. The files are:


a. hts_conc_2019.sas7bdat
********************************************
SAS version of the concordance of HTS10 codes over time from Pierce and Schott (2012)


b. deflator_dec2020.dta
********************************************
Stata version of the GDP deflator from FRED, seasonally adjusted, with 2012=100. Variable "quarter" is computed as (year*4 + quarter number).


c. deflator_dec2020.sas7bdat
********************************************
SAS version of the GDP deflator from FRED, seasonally adjusted, with 2012=100.


d. ExchangeRatesQ_v5_new.dta
********************************************
Stata version of the quarterly average exchange rates from Bloomberg, in foreign currency per U.S. dollar. The file contains the log exchange rate "lfxrate" and the change in the log exchange rate over 1, 2, 3, and 4 quarters.


e. country_indicators3.dta
********************************************
Country characteristics from the World Bank and Taiwan Statistics Office. Contains GDP, GDP per capita, rule of law indices, and OECD membership for different countries.


f. country_indicators_pct.dta
********************************************
Terciles of the GDP per capita and the rule of law distribution for all countries, constructed from country_indicators3.dta.


g. gdpdata_new.csv
********************************************
U.S. quarterly log GDP from 1991-2021, constructed from FRED data.


h. gdp_downstream_cy.dta and gdp_downstream_cy_n5.dta
********************************************
Log downstream GDP and cyclical component of log downstream GDP for industries at the 6-digit NAICS level (gdp_downstream_cy.dta) and 5-digit level (gdp_downstream_cy_n5.dta) for 1997-2016, constructed from BEA industry gross output data and the IO matrix.





*******************
ii. Bloomberg folder
*******************

The bloomberg folder comprises 3 main folders:
	data
	programs
	results

Researchers should run the code files in the /programs folder to generate Figures A.1 and A.2 in the text. These files load the raw data from the /data folder and produce the figures in the paper in the /results folder.


**************************************************
********** DATA **********
**************************************************

This folder contains 4 sub folders:

a. raw_excel
*******************************************

This folder is empty. Researchers with a Bloomberg license should copy into each year 2012-2018 in this folder Excel files with the results from the SPLC function on March 1 of the given year for each of the top-200 firms by market capitalization in the S&P500 on March 1, 2018. The files should be saved as, e.g., AAPL2012.xlsx, ABBV2012.xlsx, etc.


b. ticker_name_xwalk
*******************************************

This folder contains the file SPX_as_of_01Mar2018.xlsx. This file contains an ordered list of the companies in the S&P500 on March 1, 2018 by market capitalization. 


c. intermediate
*******************************************

This folder is empty. The programs in the bloomberg folder will save here cleaned versions of each company's supplier relationships in each year.


d. final
*******************************************

This folder is empty. The programs in the bloomberg folder will save here a final output file "master.dta" that contains the supplier relationships of the top-200 firms in the S&P500 in 2012-2018.



**************************************************
********** PROGRAMS **********
**************************************************

**
master.do
	- This file is the master program. Running it will run all the do files in the folder in the proper order to generate Figure A.1 and Figure A.2 in the paper.


**
duplicatesDrop_SP500.do
	- This file loads the companies in the S&P500 on March 1, 2018 from the file SPX_as_of_01Mar2018.xlsx into Stata, cleans the file, and removes duplicate observations of companies with multiple tickers (for example, Alphabet, Inc. appears twice, once with the ticker GOOG and once with the ticker GOOGL). 
	- Inputs: (1) /data/ticker_name_xwalk/SPX_as_of_01Mar2018.xlsx
	- Outputs: (1) /data/ticker_name_xwalk/SPX_as_of_01Mar2018_noduplicates.dta (file without duplicates), (2) /data/ticker_name_xwalk/SPX200_as_of_01Mar2018.dta (retains only the top 200 companies by market capitalization)


**
cleanRaw.do
	- This file loads the raw Excel files with companies' supplier relationships from the /data/raw_excel folder, cleans them, and saves them as Stata data.
	- Inputs: (1) raw Excel files with individual companies' supplier relationships (e.g., AAPL2012.xlsx, ABBV2012.xlsx, etc.) in the 2012-2018 folders in /data/raw_excel, (2) /data/ticker_name_xwalk/SPX_as_of_01Mar2018_noduplicates.dta
	- Outputs: (1) cleaned files with individual companies' supplier relationships (e.g., AAPL2012.dta, ABBV2012.dta, etc.) in the 2012-2018 folders in /data/intermediate


**
duplicatesDrop_withinYrByCo.do
	- This file loads the companies' Stata files from the /data/intermediate folder and appends together files where the same company has multiple files in the same year (this happens when a company has a large number of supplier relationships). The code saves the resulting Stata files into the /data/intermediate folder.
	- Inputs: (1) cleaned files with individual companies' supplier relationships (e.g., AAPL2012.dta, ABBV2012.dta, etc.) in the 2012-2018 folders in /data/intermediate, (2) /data/ticker_name_xwalk/SPX_as_of_01Mar2018_noduplicates.dta
	- Outputs: (1) cleaned files (e.g., AAPL2012.dta, ABBV2012.dta, etc.) in the 2012-2018 folders in /data/intermediate, overwriting the original ones


**
appendIntermediate.do
	- This file appends together the individual companies' files across all years into a final Stata file containing data for 2012-2018 for the top-200 companies in the S&P500 on March 1, 2018. This file is saved as /data/final/master.dta.
	- Inputs: (1) cleaned files (e.g., AAPL2012.dta, ABBV2012.dta, etc.) in the 2012-2018 folders in /data/intermediate, (2) /data/ticker_name_xwalk/SPX200_as_of_01Mar2018.dta
	- Outputs: (1) /data/final/master.dta


**
analyze.do
	- This file performs the analysis. It generates Figures A.1 and A.2 in the paper.
	- Inputs: (1) /data/final/master.dta
	- Outputs: (1) /results/domestic_splch.pdf (for Figure A.1), (2) /results/COMP_splych.pdf (where COMP stands for one of 6 companies for Figure A.2)
	


**************************************************
********** RESULTS **********
**************************************************

This folder contains the final plots for Figures A.1 and A.2 in the paper. The folder contains figure domestic_splych.pdf (for Figure A.1) and six figures for the six individual companies in Figure A.2.





*******************
iii. Census folder
*******************

The census folder comprises 4 main folders:
	rawdata
	data
	codes
	results

Researchers need to replicate this folder structure at the RDC and then prepare these directories as described below. Note that to satisfy Census disclosure guidelines, which prohibit disclosure of raw variable names, some variables appearing in the Census data had to be renamed in my codes. At the RDC these have to be renamed back to the actual variable names. The new variable names I use and their meaning are:

LFTTD
date_e_raw	= export date
date_i_raw	= import date
firm_id 	= U.S. firm ID
mid		= foreign manufacturer ID in the import data
hs_code 	= 10-digit HS Code
rel_party	= related party
imp_value	= import value
imp_quantity	= import quantity
imp_type 	= import type
bloop_id        = blooper ID

LBD
firm_id 	= U.S. firm ID
lbd_num    	= unique LBD number
tot_emp     	= employment
tot_pay     	= payroll

Authors have to specify the data folders for the LFTTD and LBD at the RDC, or copy raw data files into the "rawdata" folder.

Researchers need to run the codes in the /codes folder. These load the raw data from the /rawdata folder and save cleaned datasets into the /data folder. The figures and tables of the paper are generated in the /results folder.



**************************************************
********** RAWDATA **********
**************************************************

This folder is empty. Researchers can copy the raw microdata files from the Census into this folder and load them from there, or alternatively load them directly from the original Census directories.



**************************************************
********** DATA **************
**************************************************

This folder is empty. Researchers need to copy the user-provided public data from the /public/data folder into this folder. Additionally, the codes will save any intermediate datasets into this folder.



**************************************************
********** RESULTS **************
**************************************************

This folder saves the results generated by the codes. 




**************************************************
********** CODES **********
**************************************************

The codes folder contains two subfolders: prep and analysis. The /prep folder contains the data preparation codes. The /analysis folder contains the analysis codes. The /prep folder contains a mix of SAS and Stata code files. These have to be run in the order of their numbering. The /analysis folder contains only Stata codes. These can be run using the master.do file.


********** PREP *******************

The /prep folder contains three subfolders: i) baseline, ii) shortened, iii) concorded. The /baseline folder contains the codes to prepare the data using the reported MID as foreign manufacturer identifier. The /shortened folder prepares the data using the shortened MIDs as foreign manufacturer identifiers, dropping the name and the address component. The /concorded folder contains the codes to prepare the data using the concorded MID as foreign manufacturer identifier, using the methodology by Heise and Dam (2023) to generate time-consistent concorded MIDs. The concordance by Heise and Dam (2023) is available internally at the Census and needs to be loaded in for these files to run. 



********** BASELINE ***************

This folder contains the baseline data preparation files using the reported MID as foreign manufacturer identifier.


**
01_sas_data_prep_01.sas 
	- This file conducts the initial cleaning of the raw SAS files at the Census using the reported MIDs as foreign manufacturer identifiers. It concords the HTS10 codes over time and deflates the import values using the GDP deflator.
	- Inputs: (1) LFTTD raw data files 1992-2017, (2) data/hts_conc_2019.sas7bdat (Concordance of HTS10 codes over time), (3) data/deflator_Dec2020.sas7bdat (GDP deflator)
	- Outputs: (1) data/impdata5t_old.sas7bdat


**
02_sas_data_checks_03.sas 
	- This file prepares the output files to compute the sample statistics for Table A.1 in Appendix A. 
	- Inputs: (1) LFTTD raw data files 1992-2017, (2) data/hts_conc_2019.sas7bdat (Concordance of HTS10 codes over time), (3) data/deflator_Dec2020.sas7bdat (GDP deflator)
	- Outputs: (1) data/lfttd_base1_old.dta, (2) data/lfttd_base2_old.dta, (3) data/lfttd_base3_old.dta


**
03_lbd_prep_01.sas 
	- This file prepares the LBD data files, combines the years into one dataset, and exports the combined dataset to Stata. 
	- Inputs: (1) LBD raw data files 1992-2017 
	- Outputs: (1) data/lbd_master.dta


**
04_lbd_collapse_02.do
	- This file collapses the establishment-level LBD data to the firm-level, using the NAICS codes associated with the largest number of employees for each firm. 
	- Inputs: (1) data/lbd_master.dta
	- Outputs: (1) data/lbd_firm_naics.dta


**
05_sas_relationship_03.sas 
	- This file collapses transactions of the same relationship-product in the LFTTD on the same day into one, drops related party trade, and assigns relationships. 
	- Inputs: (1) data/impdata5t_old.sas7bdat
	- Outputs: (1) data/relationship6_old.sas7bdat, (2) data/gap_time_old.dta


**
06_sas_relationship_naive_03.sas 
	- This file collapses transactions of the same relationship-product in the LFTTD on the same day into one, drops related party trade, and assigns relationships using the naive definition of relationships. 
	- Inputs: (1) data/impdata5t_old.sas7bdat
	- Outputs: (1) data/relationship6_naive_old.sas7bdat


**
07_sas_price_level_06.sas 
	- This file computes unit values, removes time series and cross sectional outliers, and exports the data to Stata.
	- Inputs: (1) data/relationship6_old.sas7bdat
	- Outputs: (1) data/price_analysis3_old.dta


**
08_sas_price_level_naive_06.sas 
	- This file computes unit values, removes time series and cross sectional outliers, and exports the data to Stata, using the naive definition of relationships.
	- Inputs: (1) data/relationship6_naive_old.sas7bdat
	- Outputs: (1) data/price_analysis3_naive_old.dta


**
09_passthrough_v21.do
	- This file prepares the dataset for the pass-through regressions.
	- Inputs: (1) data/price_analysis3_old.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta, (4) data/country_indicators3.dta, (5) data/country_indicators_pct.dta
	- Outputs: (1) data/passthroughQ7_old.dta, (2) data/baseline_pt_old.dta


**
10_passthrough_naive_v20.do
	- This file prepares the dataset for the pass-through regressions using the naive definition of relationships.
	- Inputs: (1) data/price_analysis3_naive_old.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta, (4) data/country_indicators3.dta, (5) data/country_indicators_pct.dta
	- Outputs: (1) data/passthroughQ7_naive_old.dta, (2) data/baseline_pt_naive_old.dta


**
11_passthrough_annual_v3.do
	- This file prepares the dataset for the pass-through regressions at the annual level.
	- Inputs: (1) data/price_analysis3_old.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta
	- Outputs: (1) data/passthroughY_st_old.dta


**
13_passthrough_heckman_v9.do
	- This file prepares the dataset for the Heckman selection model pass-through regressions.
	- Inputs: (1) data/price_analysis3_old.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta
	- Outputs: (1) data/passthrough_heck8_old.dta



********** SHORTENED ***************

**
01_sas_data_prep_01_new.sas 
	- This file conducts the initial cleaning of the raw SAS files at the Census using the shortened MIDs as foreign manufacturer identifiers, dropping the name and the address component. The file concords the HTS10 codes over time and deflates the import values using the GDP deflator.
	- Inputs: (1) LFTTD raw data files 1992-2017, (2) data/hts_conc_2019 (Concordance of HTS10 codes over time), (3) data/deflator_Dec2020 (GDP deflator)
	- Outputs: (1) data/impdata5t_new.sas7bdat


**
02_sas_data_checks_03_new.sas 
	- This file prepares the output files to compute the sample statistics for Table A.2 in Appendix A. 
	- Inputs: (1) LFTTD raw data files 1992-2017, (2) data/hts_conc_2019 (Concordance of HTS10 codes over time), (3) data/deflator_Dec2020 (GDP deflator)
	- Outputs: (1) data/lfttd_base1_new.dta, (2) data/lfttd_base2_new.dta, (3) data/lfttd_base3_new.dta


**
05_sas_relationship_03_new.sas 
	- This file collapses transactions of the same relationship-product in the LFTTD on the same day into one, drops related party trade, and assigns relationships. 
	- Inputs: (1) data/impdata5t_new.sas7bdat
	- Outputs: (1) data/relationship6_new.sas7bdat, (2) data/gap_time_new.dta


**
07_sas_price_level_06_new.sas 
	- This file computes unit values, removes time series and cross sectional outliers, and exports the data to Stata.
	- Inputs: (1) data/relationship6_new.sas7bdat
	- Outputs: (1) data/price_analysis3_new.dta


**
09_passthrough_v20_new.do
	- This file prepares the dataset for the pass-through regressions.
	- Inputs: (1) data/price_analysis3_new.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta, (4) data/country_indicators3.dta, (5) data/country_indicators_pct.dta
	- Outputs: (1) data/passthroughQ7_new.dta, (2) data/baseline_pt_new.dta


**
11_passthrough_annual_v3_new.do
	- This file prepares the dataset for the pass-through regressions at the annual level.
	- Inputs: (1) data/price_analysis3_new.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta
	- Outputs: (1) data/passthroughY_st_new.dta


**
13_passthrough_heckman_v9_new.do
	- This file prepares the dataset for the Heckman selection model pass-through regressions.
	- Inputs: (1) data/price_analysis3_new.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta
	- Outputs: (1) data/passthrough_heck8_new.dta



********** CONCORDED ***************

**
01_sas_data_prep_01_conc.sas 
	- This file conducts the initial cleaning of the raw SAS files at the Census to generate time-consistent concorded MIDs. The concordance to map the original MIDs to concorded MIDs is from Heise and Dam (2023) and can be obtained internally at the Census. The file concords the HTS10 codes over time and deflates the import values using the GDP deflator.
	- Inputs: (1) LFTTD raw data files 1992-2017, (2) data/hts_conc_2019 (Concordance of HTS10 codes over time), (3) data/deflator_Dec2020 (GDP deflator), (4) data/mid_concordance.sas7bdat (Concordance from Heise and Dam (2023))
	- Outputs: (1) data/impdata5t_conc.sas7bdat


**
02_sas_data_checks_03_conc.sas 
	- This file prepares the output files to compute the sample statistics for Table A.2 in Appendix A. 
	- Inputs: (1) LFTTD raw data files 1992-2017, (2) data/hts_conc_2019 (Concordance of HTS10 codes over time), (3) data/deflator_Dec2020 (GDP deflator), (4) data/mid_concordance.sas7bdat (Concordance from Heise and Dam (2023))
	- Outputs: (1) data/lfttd_base1_conc.dta, (2) data/lfttd_base2_conc.dta, (3) data/lfttd_base3_conc.dta


**
05_sas_relationship_03_conc.sas 
	- This file collapses transactions of the same relationship-product in the LFTTD on the same day into one, drops related party trade, and assigns relationships. 
	- Inputs: (1) data/impdata5t_conc.sas7bdat
	- Outputs: (1) data/relationship6_conc.sas7bdat, (2) data/gap_time_conc.dta


**
07_sas_price_level_06_conc.sas 
	- This file computes unit values, removes time series and cross sectional outliers, and exports the data to Stata.
	- Inputs: (1) data/relationship6_conc.sas7bdat
	- Outputs: (1) data/price_analysis3_conc.dta


**
09_passthrough_v20_conc.do
	- This file prepares the dataset for the pass-through regressions.
	- Inputs: (1) data/price_analysis3_conc.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta, (4) data/country_indicators3.dta, (5) data/country_indicators_pct.dta
	- Outputs: (1) data/passthroughQ7_conc.dta, (2) data/baseline_pt_conc.dta


**
11_passthrough_annual_v3_conc.do
	- This file prepares the dataset for the pass-through regressions at the annual level.
	- Inputs: (1) data/price_analysis3_conc.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta
	- Outputs: (1) data/passthroughY_st_conc.dta


**
13_passthrough_heckman_v9_conc.do
	- This file prepares the dataset for the Heckman selection model pass-through regressions.
	- Inputs: (1) data/price_analysis3_conc.dta, (2) data/deflator_dec2020.dta, (3) data/ExchangeRatesQ_v5_new.dta
	- Outputs: (1) data/passthrough_heck8_conc.dta




********** ANALYSIS ***************


**** Main text

**
master.do
	- This file is the master file of the analysis. It generates all the figures and tables in the paper. Running this file will run all the following do files.


**
fig02a.do
	- This file generates Figure 2a: "Life Cycle of Value Traded" and Figure E.1 "Relationship Life Cycle - Other Variables"
	- Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) data/rel_cross.dta, (2) data/life_cycle_old.dta, (3) results/fig02a_uncond.csv, (4) results/fig02a_cond.csv, (5) results/figE1_uncond.csv, (6) results/figE1_cond.csv


**
fig01a.do
	- This file generates Figure 1a: "Relationships by Length (in Months)"
	- Inputs: (1) data/price_analysis3_old.dta, (2) data/rel_cross.dta
	- Outputs: (1) results/fig01a.csv


**
fig01b.do
	- This file generates Figure 1b: "Pass-Through Relative to Year One"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/fig01b.csv


**
tab01.do
	- This file generates Table 1: "Pass-Through Regressions"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tab01.csv, (2) data/tab01.dta


**
tab02_every_qtr.do
	- This file generates column 1 of Table 2: "Pass-Through Robustness" and column 1 of Table C.2-C.4
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tab02_every_qtr.csv, (2) data/tab02_every_qtr.dta


**
tab02_selection.do
	- This file generates column 2 of Table 2: "Pass-Through Robustness" and column 2 of Table C.2-C.4
	- Inputs: (1) data/passthrough_heck8_old.dta, (2) data/tab01.dta
	- Outputs: (1) results/tab02_selection.csv


**
tab02_annual.do
	- This file generates column 3 of Table 2: "Pass-Through Robustness" and column 3 of Table C.2-C.4
	- Inputs: (1) data/passthroughY_st_old.dta
	- Outputs: (1) results/tab02_annual.csv


**
tab02_size.do
	- This file generates columns 4-5 of Table 2: "Pass-Through Robustness" and columns 4-5 of Table C.2-C.4
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tab02_size.csv


**
tab02_country.do
	- This file generates column 6 of Table 2: "Pass-Through Robustness" and column 6 of Table C.2-C.4
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tab02_country.csv


**
tab02_country_fe.do
	- This file generates column 7 of Table 2: "Pass-Through Robustness" and column 7 of Table C.2-C.4
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tab02_country_fe.csv


**
tab02_country_posneg.do
	- This file generates columns 8-9 of Table 2: "Pass-Through Robustness" and columns 8-9 of Table C.2-C.4
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tab02_posneg.csv


**
fig02b.do
	- This file generates Figure 2b: "Relationship Break-Up Hazard"
	- Inputs: (1) data/price_analysis3_old.dta, (2) data/rel_cross.dta
	- Outputs: (1) results/fig02b.csv


**
tab03.do
	- This file generates Table 3: "Price Setting by Relationship Length"
	- Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) results/tab03.csv, (2) data/price_cycle_old_cross.dta


**
tab04b_acf.do
	- This file generates the autocorrelation of quantity (moment to find rho) in Table 4b: "Estimated Parameters"
	- Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) results/tab04b_acf.csv


**
tab04b_std_p.do
	- This file generates the standard deviation of initial relationship prices (moment to find chi) in Table 4b: "Estimated Parameters"
	- Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) results/tab04b_std_p.csv


**
fig05a.do
	- This file generates Figure 5a: "Creation Margins as Share of Total Imports" and Figure5b: "Destruction Margins as Share of Total Imports"
	- Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) results/fig05a.csv


**
fig05c.do
	- This file generates Figure 5c: "Pass-Through and Relationship Creation in the Data"
	- Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) results/fig05a.csv



**** Appendix material


**
tabA1.do
	- This file generates Table A.1: "Baseline with Original MID"
	- Inputs: (1) data/lfttd_base1_old.dta, (2) data/lfttd_base2_old.dta, (3) data/lfttd_base3_old.dta, (4) relationship6_old.dta, (5) price_analysis3_old.dta, (6) ExchangeRatesQ_v5_new.dta, (7) baseline_pt_old.dta
	- Outputs: (1) results/tabA1.csv


**
tabA2.do
	- This file generates Table A.2: "Shortened MID"
	- Inputs: (1) data/lfttd_base3_new.dta, (2) baseline_pt_new.dta
	- Outputs: (1) results/tabA2.csv


**
tabA3.do
	- This file generates Table A.3: "Concorded MID"
	- Inputs: (1) data/lfttd_base3_conc.dta, (2) baseline_pt_conc.dta
	- Outputs: (1) results/tabA3.csv


**
tabB1.do
	- This file generates Table B.1: "Summary Statistics", Table B.2 "Distribution of Relationship Length by Importer Sector", and Figure B.1 "Trade Distribution by Importer Sector"
	- Inputs: (1) data/lfttd_base3_old.dta, (2) data/gap_time_old.dta, (3) data/relationship6_old.dta, (4) data/lbd_firm_naics.dta
	- Outputs: (1) results/tabB1.csv, (2) results/tabB2.csv, (3) results/figB1.csv


**
tabC1.do
	- This file generates Table C.1: "Pass-Through by Total Length Groups"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabC1.csv


**
tabC5.do
	- This file generates Table C.5: "Pass-Through - Heterogeneity by Frequency of Trade, Size, and Products"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabC5.csv


**
tabC6.do
	- This file generates Table C.6: "Pass-Through Robustness: Specifications with Lags"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabC6.csv


**
tabC7.do
	- This file generates Table C.7: "Pass-Through - Country Groups"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabC7.csv


**
tabC8.do
	- This file generates Table C.8: "Pass-Through - Currency Groups"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabC8.csv


**
tabC9.do
	- This file generates Table C.9: "Pass-Through Regressions with Shortened MID" and Table C.10.: "Pass-Through Robustness - Relationship Length in Months with Shortened MID"
	- Inputs: (1) data/baseline_pt_new.dta, (2) data/passthroughY_st_new.dta, (3) data/passthrough_heck8_new.dta
	- Outputs: (1) results/tabC9.csv, (2) results/tabC10.csv


**
tabC11.do
	- This file generates Table C.11: "Pass-Through Regressions with Concorded MID" and Table C.12.: "Pass-Through Robustness - Relationship Length in Months with Concorded MID"
	- Inputs: (1) data/baseline_pt_conc.dta, (2) data/passthroughY_st_conc.dta, (3) data/passthrough_heck8_conc.dta
	- Outputs: (1) results/tabC11.csv, (2) results/tabC12.csv


**
tabC13.do
	- This file generates Table C.13: "Pass-Through - Control for Total Length"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabC13.csv


**
tabC14.do
	- This file generates Table C.14: "Pass-Through - Network of Firms"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabC14.csv


**
tabC15.do
	- This file generates Table C.15: "Pass-Through - Exporter-Product Fixed Effects"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabC15.csv


**
tabC16.do
	- This file generates Table C.16: "Im-Paseran-Shin Test for Unit Roots"
	- Inputs: (1) data/baseline_pt_old.dta, (2) data/ExchangeRatesQ_v5_new.dta
	- Outputs: (1) results/tabC16.csv


**
tabC17.do
	- This file generates Table C.17: "Pass-Through - "Naive" Relationship Definition"
	- Inputs: (1) data/baseline_pt_naive_old.dta, (2) data/tab01.dta, (3) data/tab02_every_qtr.dta
	- Outputs: (1) results/tabC17.csv


**
figE2.do
	- This file generates Figure E.2: "Life Cycle of Value Traded with Different Exporter Definitions"
	- Inputs: (1) data/price_analysis3_new.dta, (2) data/price_analysis3_conc.dta
	- Outputs: (1) results/figE2a.csv, (2) results/figE2b.csv


**
tabE1.do
	- This file generates Table E.1: "Price Setting by Relationship Length - Shortened MID" and Table E.2: "Price Setting by Relationship Length - Concorded MID"
	- Inputs: (1) data/price_analysis3_new.dta, (2) data/price_analysis3_conc.dta
	- Outputs: (1) results/tabE1.csv, (1) results/tabE2.csv


**
tabE3.do
	- This file generates Table E.3: "Prices and Quantity by Relationship Length"
	- Inputs: (1) data/price_analysis3_old.dta, (2) data/gdpdata_new.csv, (3) data/lbd_firm_naics.dta, (4) data/gdp_downstream_cy.dta, (5) data/gdp_downstream_cy_n5.dta, (6) data/rel_cross.dta
	- Outputs: (1) results/tabE3.csv


**
tabE4.do
	- This file generates Table E.4: "Price Regressions by Industry"
	- Inputs: (1) data/price_cycle_old_cross.dta
	- Outputs: (1) results/tabE4.csv


**
tabJ1.do
	- This file generates Table J.1: "Break-up Statistics for Relationships >= 12 Months"
	- Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) results/tabJ1.csv


**
tabJ1_new_importer.do
	- This file generates the statistic for the number of months it takes an exporter to find an additional customer in Appendix J.1
        - Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) results/tabJ1_new_importer.csv


**
figK1.do
	- This file generates Figure K.1a: "Creation Margins using Shortened MID" and Figure K.1b: "Destruction Margins using shortened MID"
	- Inputs: (1) data/price_analysis3_new.dta
	- Outputs: (1) results/figK1.csv


**
figK2.do
	- This file generates Figure K.2a: "Creation Margins using concorded MID" and Figure K.2b: "Destruction Margins using concorded MID"
	- Inputs: (1) data/price_analysis3_conc.dta
	- Outputs: (1) results/figK2.csv


**
figK3.do
	- This file generates Figure K.3a: "Creation Margins under Naive Relationship Definition" and Figure K.3b: "Destruction Margins under Naive Relationship Definition"
	- Inputs: (1) data/price_analysis3_naive_old.dta
	- Outputs: (1) results/figK3.csv


**
figK4.do
	- This file generates Figure K.4a: "Creation Margins for Importers" and Figure K.4b: "Destruction Margins for Importers"
	- Inputs: (1) data/price_analysis3_old.dta
	- Outputs: (1) results/figK4.csv


**
figK5.do
	- This file generates Figure K.5: "Pass-Through in the LFTTD"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/figK5.xlsx


**
tabL1_neg_pt.do
	- This file generates columns 1-3 of Table L.1: "Model Implication Tests"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabL1_neg_pt.csv


**
tabL1_outside.do
	- This file generates column 4 of Table L.1: "Model Implication Tests"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabL1_outside.csv


**
tabL1_totlength.do
	- This file generates column 5 of Table L.1: "Model Implication Tests"
	- Inputs: (1) data/baseline_pt_old.dta
	- Outputs: (1) results/tabL1_totlength.csv




*******************
iv. Matlab folder
*******************


The matlab folder is comprised of 3 main folders:
	codes
	data
	output

The codes folder contains the MATLAB files that produce the figures in the paper. The data folder contains the datasets generated by the codes. The output folder contains the figures generated by the codes.
 

***********
** CODES **
***********

The /codes folder contains 8 subfolders: the "MCMC" folder, where we perform the main MCMC estimation, the "functions" folder, which contains auxiliary functions called in other files, and 6 folders named after the figure they produce. We detail each folder below. Files in each subfolder should be run in the order they are listed.


** MCMC **
    
    **
    MCMCmasterMCMC_v22.m
	- This file runs the main MCMC estimation. It is set to run across 100 parallel strings for 120 periods each, for which we requested 75G for the main program and 50G per worker. Due to computational limits, we ran this file 4 times separately to get 400 total simulations.
	    - Inputs: None
	    - Outputs: data/MCMC_out_partX.mat

    **
    get_best_params.m
 	    - This file combines the output from masterMCMC_v22.m, finds the 20 best parameter vectors and computes their standard deviation to be used in the bottom panel of Table 4. This file has minimal memory requirements and can be run locally. 
	    - Inputs: data/MCMC_out_partX.mat
	    - Outputs: None



** model_Fig3 **
    
    ** 
    master_onerun_v20_fc.m
	    - This file produces Figures 3a and 3b. This file has minimal memory requirements and can be run locally. 
	    - Inputs: None
	    - Outputs: Figure 3a and 3b

    ** 
    master_onerun_v20_lc.m
	    - This file produces Figures 3c and 3d. This file has minimal memory requirements and can be run locally. 
	    - Inputs: None
	    - Outputs: Figure 3c and 3d
	


** final_run_Fig_4 **
    
    **
    master_onerun_v20.m
	    - This file produces Figure 4 and Figure J.3. Using the best parameter vector from the MCMC, the file simulates the model 10 times, takes the average over these simulations, and plots Figures 4 and J.3. This file is set to run across 10 parallel strings and requires 50G for the main program and 10G per worker. 
	    - Inputs: None
	    - Outputs: Figure 4, Figure J.3



** simulation_Fig_5d **

    **
    master_onerun_v20.m 
	    - This file is the same as in the final_run_Fig_4 subfolder. This file is set to run across 10 parallel strings and requires 50G for the main program and 10G per worker. 
	    - Inputs: None
	    - Outputs: data/simulation_Fig_5d_part1.mat

    **
    shock_baseline_v14.m
	    - This file simulates the model with a shock in t=1. This file is set to run across 25 parallel strings and requires 150G for the main program and 5G per worker. 
	    - Inputs: data/simulation_Fig_5d_part1.mat
	    - Outputs: data/simulation_Fig_5d_part2.mat

    **
    shock_with_option_v6.m
	    - This file simulates the model with a shock in t=1 and adjusting outside options. This file requires 150G for the main program.
	    - Inputs: ../../data/simulation_Fig_5d_part2.mat
	    - Outputs: Figure 5d, data/simulation_Fig_5d_part3.mat



** nash_Fig_H1

    **
    nash_Fig_H1/ModelNB_v3.m
	    - This file plots Figure H.1. It has minimal memory requirement and can be run locally. 
	    - Inputs: None
	    - Outputs: Figure H.1



** identification_Fig_J1

    ** 
    master_v52_oneparam.m
	    - This file provides additional analysis for identification. We vary each parameter along a linear grid holding the others 
	      fixed at their baseline values. This file is set to run across 20 parallel strings and requires 5G for the main program and
	      2G per worker.
	    - Inputs: None
	    - Outputs: data/identification_Fig_J1_060424.mat

    ** 
    Identification_plot_v3.m
	    - This file plots Figure J.1. It has minimal memory requirement and can be run locally. 
	    - Inputs: data/identification_Fig_J1_060424.mat
	    - Outputs: Figure J.1



** identification_Fig_J2

    ** 
    one_param_100vec_v2.m
	    - This file provides additional analysis for identification. We draw 100 random parameter vectors and, for each parameter vector, vary
	      each parameter one-by-one along a linear grid while holding others fixed. This file is set to run across 100 parallel strings
	      and requires 5G for the main program and 2G per worker. 
	    - Inputs: None
	    - Outputs: data/identification_Fig_J2_060424.mat

    **
    identification_plot.m
	    - This file plots Figure J.2. It has minimal memory requirement and can be run locally.
	    - Inputs: data/identification_Fig_J2_060424.mat
	    - Outputs: Figure J.2




** functions **

    ** 
    check_repeat.m
	    - This function is called in masterMCMC_v22.m and runs an accuracy check on the current parameter vector. It dictates whether 
              we update the current "best" parameter vector or not. 

    ** 
    functions/epsclean.m 
	    - This function does some formatting of .eps files. 

    **
    functions/estimation_v15_noglobal.m
	    - This function solves for value functions and policies. 

    **
    functions/estimation_v15_noglobal_fc.m
	    - This function solves for value functions and policies for figures 3a and 3b in the case with "full commitment", where the buyer's participation constraint is ignored. 

    **
    functions/estimation_v15_noglobal_lc.m
	    - This function solves for value functions and policies for figures 3c and 3d.

    ** 
    functions/param_fun_v3_noglobal.m
	    - This function initializes some parameters.

    ** 
    functions/paras_fixed_v1_noglobal_v2.m
	    - This function initializes some fixed parameters.

    ** 
    functions/paras_fixed_v1_noglobal_v2_fc.m
	    - This function initializes some fixed parameters for figures 3a and 3b in the case with "full commitment", where the buyer's participation constraint is ignored.

    ** 
    functions/paras_fixed_v1_noglobal_v2_fc.m
	    - This function initializes some fixed parameters for figures 3c and 3d.

    ** 
    functions/quant_paras_v5.m
	    - This function is called in shock_baseline_v14.m and initializes some parameters for the shock simulation. 

    **
    functions/set_fun_sob_v1.m
	    - This function defines the initial parameter guess and the support over which we search.

    **
    functions/shock_simulation_v3.m
	    - This function gets called in shock_baseline_v14.m and runs a modified version of the simulation file. 

    **
    functions/simulation_v20.m
	    - This function simulates a panel of relationships for the simulation results. 

    **
    functions/statistics_shocks_v1.m
	    - This function gets called in shock_baseline_v14.m and computes some statistics for the shock analysis.

    **
    functions/target_fun_v2.m
	    - This function defines the moment values we target. 

    ** 
    functions/target_sim_fun.m
	    - This function writes the estimated moments into a vector. 

    **
    functions/tauchen.m
	    - This function is called in simulation_v20.m and implements Tauchen's (1986) algorithm.


***********
** DATA **
***********

This folder is empty. It holds the Matlab data files generated by the codes.


***********
** OUTPUT **
***********

This folder is empty. It stores the figures generated by the codes that are used in the paper.



********************************
4. References
********************************

Berger, David, and Joseph Vavra (2019). "Shocks versus Responsiveness: What Drives Time-Varying Dispersion?." Journal of Political Economy Volume 127(5). 2104-2142.

Heise, Sebastian, and Dam, David (2023). "Generating a Time-Consistent Manufacturer ID (MID) in Census Import Data," CES Technical Notes Series 23-22, Center for Economic Studies, U.S. Census Bureau.

Pierce, Justin R., and Schott, Peter K. (2012). "Concording U.S. Harmonized System Codes over Time." Journal of Official Statistics. Volume 28(1). 53-68.

Tauchen, G. (1986). Finite state markov-chain approximations to univariate and vector autoregressions. Economics letters, 20(2), 177-181.

World Bank. (2018). World Development Indicators Database. Accessed 2018-11-08. https://databank.worldbank.org/reports.aspx?source=2&series=NY.GDP.MKTP.KD&country=.




